#if !defined(AFX_TABBARSWND_H__B581F81B_AD07_4296_A80B_055BF0B1166C__INCLUDED_)
#define AFX_TABBARSWND_H__B581F81B_AD07_4296_A80B_055BF0B1166C__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// TabBarsWnd.h : header file
//
#include "TabCtrlEx.h"

#include "SiWindow.h"

#define		TABBAR_WINDOW_TIMERID					0x201

/////////////////////////////////////////////////////////////////////////////
// CTabBarsWnd window

class CTabBarsWnd : public CReBar
{
  friend class CTabManagerWindow;

// Construction
public:
	CTabBarsWnd();

// Attributes
public:
	//CWnd               m_mfh;
	CToolBar           m_wndToolBar;
  CTabCtrlEx         *m_pTabCtrl;
  int                 m_iLockUpdates;

	UINT		m_uTimerID;

	void UpdateTabs();
	void ShutDownTabSiPlus();

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CTabBarsWnd)
	public:
	virtual BOOL DestroyWindow();
	protected:
	virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
	//}}AFX_VIRTUAL

// Implementation
public:
	void SetTabFont(CFont *pFont, BOOL bHasIcons);
	void ActivateTab(int iIndex);
	virtual ~CTabBarsWnd();
protected:
//  BOOL LoadPopupMenu(int nResourceID, BCMenu& pMenu, BCMenu *& pPopup);
	BOOL FindSIWindow(int iSel, CSiWindow*& pWindow);
	//Fis the bug on "close all except this" menu item
	void ActivateWindow(CSiWindow*& pWindow, BOOL bActive = TRUE);
	//close a window by IGenericWindow object
	void CloseSIWindow(CSiWindow*& pWindow);

	int CloseWindowLimited();
	BOOL CheckRowCount();
	void UpdateStyle();
	void UpdateRebar();

	// Generated message map functions
protected:
    //{{AFX_MSG(CTabBarsWnd)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnWindowPosChanged(WINDOWPOS FAR* lpwndpos);
	afx_msg void OnPaint();
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnNcDestroy();
	afx_msg void OnDestroy();
	//afx_msg void OnToolbarDropDown(NMTOOLBAR* pnmh, LRESULT* plRes);
	afx_msg void OnToolbarHeadFlip();
	afx_msg void OnMainHeadFlip();
	afx_msg void OnMainOption();
	afx_msg void OnMainHelp();
	afx_msg void OnMainSupport();
	afx_msg void OnMainShutdown();
	afx_msg void OnMainAbout();
	afx_msg void OnRbtSelect();
	afx_msg void OnRbtClose();
	afx_msg void OnRbtCloseAllExcept();
	afx_msg void OnRbtCloseAll();
	afx_msg void OnRbtHeaderFlip();
	//}}AFX_MSG
	afx_msg void OnSelchangeTabCtrl(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnToolTipTabCtrl  (NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnToolTipTabCtrlW (NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnRClickTabCtrl   (NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg LRESULT OnDbClickTabCtrl(WPARAM nTabIdx,LPARAM lParam);
	afx_msg LRESULT OnUpdateSizeAndPosition(WPARAM wParam, LPARAM lParam);
	afx_msg LRESULT OnFrameWndDestroy(WPARAM wParam, LPARAM lParam);
	afx_msg LRESULT OnUpdateTabs(WPARAM wParam, LPARAM lParam);
	afx_msg LRESULT OnCheckTabsCount(WPARAM wParam, LPARAM lParam);
	afx_msg LRESULT OnMDIActive(WPARAM wParam, LPARAM lParam);
	afx_msg LRESULT OnCheckRowCount(WPARAM wParam, LPARAM lParam);
	afx_msg LRESULT OnUpdateRebar(WPARAM wParam, LPARAM lParam);
	afx_msg LRESULT OnOptionChange(WPARAM wParam, LPARAM lParam);
DECLARE_MESSAGE_MAP();

	CFont					*m_pFont;
  HIMAGELIST    m_TabImages;
	HIMAGELIST    m_ToolbarImages;
	HIMAGELIST    m_ToolbarImagesS;
	int m_nCurRtbTab;

	//##ModelId=431C34C80203
  struct tabdata_t
  {
      HWND    hWnd;       // corresponding window
      CString cPath;      // window title (file path)
      int     iIndex;     // index in tab control
      BOOL    bVerified;  // for internal list keeping
  };

	tabdata_t * GetTabData(int iTabIndex);
	void FreeData();
	CTypedPtrMap<CMapPtrToPtr, HWND, tabdata_t *> m_TabData;
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_TABBARSWND_H__B581F81B_AD07_4296_A80B_055BF0B1166C__INCLUDED_)
